/*
 * @Author: 黑白灰01 3193273703@qq.com
 * @Date: 2025-09-10 11:23:37
 * @LastEditors: 黑白灰01 3193273703@qq.com
 * @LastEditTime: 2025-09-10 12:47:37
 * @FilePath: /auth/src/core/interceptor/transform/transform.interceptor.ts
 * @Description: 返回数据统一处理
 * 
 * Copyright (c) 2025 by 3193273703@qq.com, All Rights Reserved. 
 */
import {CallHandler, ExecutionContext, HttpStatus, Injectable,NestInterceptor,} from '@nestjs/common';
import { map, Observable } from 'rxjs';

@Injectable()
export class TransformInterceptor implements NestInterceptor {
  intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
    return next.handle().pipe(
      map((data) => {
        return {
          data,
          code: HttpStatus.OK,
          msg: '请求成功',
        };
      }),
    );
  }
}

